- Community impact
- Cooler than parking tickets
- Easy access to ~31,000 observations
2/4/2018
my_github <- "https://github.com/NathanCDay/cville_crime/raw/master/data/"
crime_counts <- readRDS(gzcon(url(paste0(my_github,"crime_counts_sf.RDS"))))
census <- readRDS(gzcon(url(paste0(my_github,"census_sf.RDS"))))
ggplot(crime_counts) +
geom_sf(data = census) +
geom_sf(aes(size = n, color = n, alpha = n)) +
scale_color_viridis() +
facet_wrap(~drug_flag)
Top 3 address for drug crime and not drug crime
arrange(crime_counts, -n) %>% group_by(drug_flag) %>% slice(1:3)
## # A tibble: 6 x 4 ## # Groups: drug_flag [2] ## address drug_flag n geometry ## <chr> <chr> <int> <S3: sfc_POINT> ## 1 600 E MARKET ST Charlottesville VA drugs 410 <S3: sfc_POINT> ## 2 400 GARRETT ST Charlottesville VA drugs 38 <S3: sfc_POINT> ## 3 700 PROSPECT AVE Charlottesville VA drugs 38 <S3: sfc_POINT> ## 4 600 E MARKET ST Charlottesville VA not_drugs 635 <S3: sfc_POINT> ## 5 700 PROSPECT AVE Charlottesville VA not_drugs 412 <S3: sfc_POINT> ## 6 1100 5TH ST SW Charlottesville VA not_drugs 341 <S3: sfc_POINT>
The police station's address is 606 E Market Street….
"…when individuals walk in to the police department to file a report the physical address of the department (606 E Market Street) is often used in that initial report if no other known address is available at the time. This is especially true for incidents of found or lost property near the downtown mall where there is no true known incident location. The same is true for any warrant services that result in a police report occurring at the police department." - CPD response
station_props <- arrange(crime_counts, -n) %>%
group_by(drug_flag) %>%
add_count(wt = n) %>%
slice(1)
with(station_props, prop.test(n, nn))
## ## 2-sample test for equality of proportions with continuity ## correction ## ## data: n out of nn ## X-squared = 2135.5, df = 1, p-value < 2.2e-16 ## alternative hypothesis: two.sided ## 95 percent confidence interval: ## 0.1810225 0.2196687 ## sample estimates: ## prop 1 prop 2 ## 0.22210184 0.02175626